﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using tools_library;
using System.Net;
using System.Net.Sockets;

namespace rclient
{
    public partial class frmExplorer : Form
    {
        HelperTool Helper = new HelperTool();
        SerializableHashtable ht = new SerializableHashtable();

        public frmExplorer()
        {
            InitializeComponent();
        }

        private void StartControl(IPEndPoint ep, bool viewOnly)
        {
            frmController controller = new frmController(ep,viewOnly);
            controller.ShowDialog();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmExplorer_Load(object sender, EventArgs e)
        {
            //get stored xml data
            ht.ReadFromFile(AppDomain.CurrentDomain.BaseDirectory + "nodes.dat");
            frmExplorer_Resize(null, null);
        }

        private void frmExplorer_Resize(object sender, EventArgs e)
        {
            //lvwConnections.Left = this.ClientRectangle.Left;
            //lvwConnections.Top = this.ClientRectangle.Top;
            lvwConnections.Size = this.ClientRectangle.Size;
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmConnect connect = new frmConnect();
            Node node= connect.ShowDialog();
            if (node != null)
            {
                StartControl(node.EndPoint,true);
            }
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //AboutBox about = new AboutBox();
            //about.ShowDialog();
        }
    }
}
